package com.tc.multicast;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.util.LinkedList;
import java.util.Queue;

public class NativeOutputStream extends OutputStream{
	Multicast core = null;
	public NativeOutputStream(Multicast mc)
	{
		this.core = mc;
	
	}

	@Override
	public void write(byte[] b, int off, int len) throws IOException {
		byte[] buf = new byte[len];
		for(int i = 0; i < len; i++)
			buf[i] = b[i + off];
		try {
			core.send(buf);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Override
	public void write(byte[] b) throws IOException {
		
		try {
			core.send(b);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Override
	public void write(int b) throws IOException {
		throw new RuntimeException("...");
		
	}
}
